import { ajax } from '@/utils'

import { JindouLifeSetting } from './jindouLifeTyps'

const baseUrl = '/yswy-jdzq-back-service'

export default {
  /** 商品列表 */
  getGoodsList(data): Promise<any> {
    return ajax.post(`${baseUrl}/life/listProduct`, data)
  },
  /** 上下架商品 */
  upDownGoods(ids, ourProductType): Promise<any> {
    return ajax.post(`${baseUrl}/life/opProduct`, { ids, ourProductType })
  },
  /** 获取商品Sku列表*/
  getGoodsSkuList(locationId, productId): Promise<any> {
    return ajax.post(`${baseUrl}/life/listSku`, {
      locationId,
      productId
    })
  },
  /** 编辑商品Sku */
  setGoodsSku(data): Promise<any> {
    return ajax.post(`${baseUrl}/life/editProduct`, data)
  },
  /** 设置商品标签*/
  setGoodsLebals(data): Promise<any> {
    return ajax.post(`${baseUrl}/life/editProductLabel`, data)
  },

  /** 站点列表 */
  getSiteList(data): Promise<any> {
    return ajax.post(`${baseUrl}/life/listLocation`, data)
  },
  /** 上下架站点 */
  upDownSites(ids, locationStatus): Promise<any> {
    return ajax.post(`${baseUrl}/life/opLocation`, { ids, locationStatus })
  },
  /** 金豆系统设置 */
  setSystemConfig(data): Promise<any> {
    return ajax.post(`${baseUrl}/life/editLiveSystem`, data)
  },
  /** 获取金豆系统设置 */
  getSystemConfig(): Promise<JindouLifeSetting> {
    return ajax.post(`${baseUrl}/life/detailLiveSystem`)
  },
  /** 订单列表 */
  getOrderList(data): Promise<any> {
    return ajax.post(`${baseUrl}/life/listOrder`, data)
  },
  /** 售后 */
  afterSale(orderNo): Promise<any> {
    return ajax.post(`${baseUrl}/life/refund`, { orderNo })
  }
}
